__author__ = 'Vili'

# import necessary modules
import json
import sys


#Open input file
#file = open("input.txt")

# define a new variable for tweets
tweets=[]

# import tweets from JSON
for line in open("input.txt"):

#line = file.readline()
#print("INDENT", json.dump(line, sort_keys=True, indent= 2))
       print(line)
       tweets.append(json.loads(line))

tweet = tweets[0]
#print (tweets[0])
#print ("INDENT", json.dumps(tweet, indent=2))
# create a new variable for a single tweets
#tweet=tweets[0]



# pull out various data from the tweets
tweet_id = [tweet['id'] for tweet in tweets]
tweet_text = [tweet['text'] for tweet in tweets]
tweet_time = [tweet['created_at'] for tweet in tweets]
tweet_author = [tweet['user']['screen_name'] for tweet in tweets]
tweet_author_id = [tweet['user']['id_str'] for tweet in tweets]
tweet_language = [tweet['lang'] for tweet in tweets]
tweet_geo = [tweet['geo'] for tweet in tweets]

#print ("VARS:", str(tweet_author).strip('[] "\''),str(tweet_time).strip('[] "\''),"\n", str(tweet_text).strip('[] "\''),"\n",
#       str(tweet_geo).strip('[] "\''))
#outstr =  str(tweet_author).strip('[] "\'')+(str(tweet_time).strip('[] "\''))+"\n"+(str(tweet_text).strip('[] "\''))+"\n"+(str(tweet_geo).strip('[] "\''))
#print("CONCAT:", outstr)
#out = json.dumps([tweet_author, tweet_time, tweet_text, tweet_geo])
print(tweets[0])
print (type(tweets[0]))
#print ("DECODE:", out)
#outfile = open("structuredt.txt",'w')
#outfile.write(outstr)